<route lang="json5" type="page">
// @formatter:off
{
  layout: 'theme',
  style: {
    navigationBarTitleText: '模拟登录页面',
    // navigationStyle: 'default', // custom default
  }
}
 // @formatter:on
</route>

<script setup lang="ts">
import { useUserStore } from '@/store'
import { redirectRouteTo } from '@/utils'

const userStore = useUserStore()

/* 假登录 */
const login = () => {
  userStore.setUserInfo({
    accessToken: 'fakeAccessToken',
    refreshToken: 'fakeRefreshToken',
  })
  userStore.setUserPerms(['admin', 'logined'])
  // 如果有重定向路径，跳转才有效
  redirectRouteTo()
}
</script>

<template>
  <button @click="login">使用假数据模拟登录</button>
</template>
